package org.example.im.controller;

import org.example.im.dto.MessageDTO;
import org.example.im.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/message")
public class MessageController {
    
    @Autowired
    private MessageService messageService;
    
    @GetMapping("/private/{userId1}/{userId2}")
    public ResponseEntity<List<MessageDTO>> getPrivateMessages(
            @PathVariable Long userId1,
            @PathVariable Long userId2) {
        return ResponseEntity.ok(messageService.getPrivateMessages(userId1, userId2));
    }
    
    @GetMapping("/group")
    public ResponseEntity<List<MessageDTO>> getGroupMessages() {
        return ResponseEntity.ok(messageService.getGroupMessages());
    }
} 